package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.fabu.EditFabuBean;
import com.lwj.liwanjia.impl.EditFabuView;
import com.lwj.liwanjia.model.EditFabuModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2018/1/16.
 */

public class EditFabuPresenter {
    private EditFabuModel editFabuModel;
    private EditFabuView editFabuView;

    public EditFabuPresenter(EditFabuView editFabuView) {
        this.editFabuView = editFabuView;
        editFabuModel = new EditFabuModel();
    }

    public void editFabuData(Map<String, Object> map, Object object) {
        editFabuModel.editFabuModel(map, object, new Subscriber<EditFabuBean>() {
            @Override
            public void onCompleted() {
                editFabuView.hideProgress();
            }

            @Override
            public void onError(Throwable e) {
                editFabuView.showError((Exception) e);
                editFabuView.hideProgress();
            }

            @Override
            public void onNext(EditFabuBean editFabuBean) {
                editFabuView.editFabuData(editFabuBean);
            }

            @Override
            public void onStart() {
                super.onStart();
                editFabuView.showProgress();
            }
        });
    }
}
